<style>
    body{
        font-size: 12px;
    }
    .bag{
        color: #fff;
        width: 4px;
        text-align: center;
    }
    .bag-1{
        background-color: #e74c3c;
    }
    .bag-2{
        background-color: #3498db;
    }
    .bag-3{
        background-color: #f39c12;
    }
    .bag-4{
        background-color: #18bc9c;
    }
    .bag-5{
        background-color: #605ca8;
    }
    .bag-6{
        background-color: #e74c3c;
    }
    .bag-7{
        background-color: #3498db;
    }
    .bag-8{
        background-color: #f39c12;
    }
    .bag-9{
        background-color: #18bc9c;
    }
    .bag-0{
        background-color: #605ca8;
    }
    .color-gray{
        color: #999999;
    }
    .margin-left{
        margin-left: 20px;
    }
    .padding{
        padding: 5px;
    }
</style>
{php}$ii=0;{/php}
<div class="panel panel-default panel-intro">
    <div class="panel-body">

        <div id="pri" class="alert alert-default-light">

            <fieldset>
                <legend>
                    <h4>包裹信息</h4>

                </legend>
                <table  class="table table-striped table-bordered table-hover table-nowrap">
                    <tbody>
                    <tr style="background-color: #fff ">
                        <td style=" vertical-align: middle;">
                            <span class="margin-left">
                            集运单号:
                            {if $row.package_no}
                                <span class="color-gray">{$row.package_no}</span>

                            {else /}
                                未填写
                            {/if}
                        </span>
<!--                            server_text-->

                            <span class="margin-left">
                            物流状态:
                            <span class="label bag-{$row.state}">{$row.state_text}</span>

                        </span>
                        <span class="margin-left">
                            订单状态:
                            <span class="label bag-{$row.state}">{$row.status_text}</span>
                        </span>
                            {if $row.express_no}
<!--                            <span class="margin-left">-->
<!--                            <button class="btn btn-xs btn-warning btn-invoice" data-id="{$row.id}">打印出库单</button>-->
<!--                        </span>-->

<!--                            <span class="margin-left">-->
<!--                            <button class="btn btn-xs btn-primary btn-track" data-id="{$row.id}">查看物流轨迹</button>-->
<!--                        </span>-->
                            {/if}

                        </td>
                    </tr>
                    <tr>
                        <td style="padding: 0">
                            {if $row.order}

                            {volist name="row.order" id="order"}
                            <table class="table table-striped table-bordered table-hover table-nowrap" style="margin-bottom: 0px">
                                <thead>
                                <tr>
                                    <th colspan="7"  style="text-align: center; vertical-align: middle;">
                                        <div class="th-inner">
                                            入库重量:{$order.delivery_weight}(kg)　
                                            来源单号:{$order.from_express_no}　
                                            {if $order.server_text}
                                            {volist name="order.server_text" id="s"}
                                            {$s.name}:{$s.price}　
                                            {/volist}
                                            {/if}
                                            订单备注:{$order.remark}
                                            订单货架号:{$order.shelf_number}
                                        </div>
                                    </th>
                                </tr>
                                <tr style="background-color: #F2F2F2">

                                    <th style="text-align: center; vertical-align: middle;">
                                        <div class="th-inner">编号</div>
                                    </th>

                                    <th style="text-align: center; vertical-align: middle;">
                                        <div class="th-inner">商品</div>
                                    </th>
                                    <th style="text-align: center; vertical-align: middle;">
                                        <div class="th-inner">分类</div>
                                    </th>

                                    <th style="text-align: center; vertical-align: middle;">
                                        <div class="th-inner">数量</div>
                                    </th>
                                    <th style="text-align: center; vertical-align: middle;">
                                        <div class="th-inner">价格</div>
                                    </th>

                                </tr>
                                </thead>

                                <tbody>
                                {if $order.goods}
                                {volist name="order.goods" id="goods" key="k"}
                                    <tr>
                                        <td style="text-align: center; vertical-align: middle;">{php} echo $ii+=1; {/php}</td>
                                        <td style="text-align: center; vertical-align: middle;">
                                            <strong>{$goods.name}</strong>
                                        </td>
                                        <td style="text-align: center; vertical-align: middle;">{$goods.category.name}</td>
                                        <td style="text-align: center; vertical-align: middle;">{$goods.number}</td>
                                        <td style="text-align: center; vertical-align: middle;">{$goods.price}</td>
                                    </tr>
                                {/volist}
                                {/if}

                                </tbody>
                            </table>
                            {/volist}
                            {/if}
                        </td>
                    </tr>

                    <tr style="background-color: #fff">
                        <td style=" vertical-align: middle;">
                            手机号:
                            <span class="color-gray">
                            {$row.address.mobile ?? '暂无添加' }
                        </span>
                            姓名:
                            <span class="color-gray">
                            {$row.address.name ?? '暂无添加' }
                        </span>
                            地址信息:
                            <span class="color-gray">
                            {if $row.address}
                            国家:{$row.address.country}　省:{$row.address.province}　市:{$row.address.city}　详细地址:{$row.address.address}
                            {else/}
                            暂无添加
                            {/if}
                        </span>
                            邮编:
                            <span class="color-gray">
                            {$row.address.zip_code ?? '暂无添加' }
                        </span>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!--discountPrice-->
                <div class="col-sm-6 padding">
                    出库总重量:{$row.delivery_weight}KG
                </div>
                <div class="col-sm-6 padding">
                    包裹邮费:{$row.delivery_price}
                </div>
                <div class="col-sm-6 padding">
                   增值费用:{$row.service_price}
                </div>
                <div class="col-sm-6 padding">
                    优惠金额:{$row.discountPrice}
                </div>
                <div class="col-sm-6 padding">
                    支付金额:{$row.delivery_price+$row.service_price-$row.discountPrice}
                </div>
                {if $row.status == 'delivered'}
                <div class="col-sm-6 padding">
                    国际快递单号:{$row.express_no}
                </div>
                {/if}
            </fieldset>
        </div>


        <?php if($row['status'] == 'complete' || $row['status'] == 'waitpackage'): ?>
        <br />
        <h2>发起支付</h2>
        <form id="edit-form" class="form-horizontal " role="form" data-toggle="validator" method="POST" action="">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_weight')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <div class="input-group">
                        <input id="c-delivery_weight" class="form-control" data-rule="range(0.01~)" step="0.01" name="row[delivery_weight]" type="number" value="{$row.delivery_weight}">
                        <span class="input-group-addon">Kg</span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_price')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-delivery_price" class="form-control" step="0.01" data-rule="range(0.01~)" name="row[delivery_price]" type="number" value="{$row.delivery_price}">
                </div>
            </div>
            <input type="hidden" name="row[status]" value="waitingpay">
            <div class="form-group ">
                <label class="control-label col-xs-12 col-sm-2"></label>
                <div class="col-xs-12 col-sm-8">
                    <button type="submit" class="btn btn-success btn-embossed">{:__('发起用户支付')}</button>
                    <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                </div>
            </div>
        </form>
        <script type="text/javascript">
            document.getElementById("delivery_weight").focus();
        </script>
        <?php endif; ?>

        <?php if($row['status'] == 'waitingpay'): ?>
        <br />
        <h2>修改支付</h2>
        <form id="edit-form" class="form-horizontal " role="form" data-toggle="validator" method="POST" action="">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_weight')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <div class="input-group">
                        <input id="c-delivery_weight" class="form-control" data-rule="range(0.01~)" step="0.01" name="row[delivery_weight]" type="number" value="{$row.delivery_weight}">
                        <span class="input-group-addon">Kg</span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_price')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-delivery_price" class="form-control" step="0.01" data-rule="range(0.01~)" name="row[delivery_price]" type="number" value="{$row.delivery_price}">
                </div>
            </div>
            <input type="hidden" name="row[status]" value="waitingpay">
            <div class="form-group  ">
                <label class="control-label col-xs-12 col-sm-2"></label>
                <div class="col-xs-12 col-sm-8">
                    <button type="submit" class="btn btn-success btn-embossed">{:__('修改用户支付')}</button>
                    <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                </div>
            </div>
        </form>
        <script type="text/javascript">
            document.getElementById("delivery_weight").focus();
        </script>
        <?php endif; ?>


        {if $row.status == 'waitingpay'}
        <br />
        <h2>支付审核</h2>
        <form id="edit-form" class="form-horizontal " role="form" data-toggle="validator" method="POST" action="">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('支付证明图片')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <div class="input-group">
                        <input id="c-pay_img" class="form-control" size="50" name="row[pay_img]" type="text" value="{$row.pay_img|htmlentities}">
                        <div class="input-group-addon no-border no-padding">
                            <span><button type="button" id="faupload-pay_img" class="btn btn-danger faupload" data-input-id="c-pay_img" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-pay_img"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                            <span><button type="button" id="fachoose-pay_img" class="btn btn-primary fachoose" data-input-id="c-pay_img" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        </div>
                        <span class="msg-box n-right" for="c-pay_img"></span>
                    </div>
                    <ul class="row list-inline faupload-preview" id="p-pay_img"></ul>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('支付提交时间')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-pay_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" disabled="disabled" name="row[pay_time]" type="text" value="{:$row.pay_time?datetime($row.pay_time):''}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('支付审核')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <div class="radio">
                        <label for="row1"><input id="row1" name="row[pay_status]" type="radio" value="1" <?php if($row['pay_status']==1): ?> checked <?php endif; ?>   /> 待审核</label>
                        <label for="row2"><input id="row2" name="row[pay_status]" type="radio" value="2" <?php if($row['pay_status']==2): ?> checked <?php endif; ?>  /> 审核通过</label>
                        <label for="row3"><input id="row3" name="row[pay_status]" type="radio" value="3"  <?php if($row['pay_status']==3): ?> checked <?php endif; ?> /> 审核不通过</label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('拒绝信息')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <textarea id="c-pay_refund_msg" class="form-control" name="row[pay_refund_msg]">{$row.pay_refund_msg}</textarea>
                </div>
            </div>

            <input type="hidden" name="pay_check" value="1" >
            <div class="form-group  ">
                <label class="control-label col-xs-12 col-sm-2"></label>
                <div class="col-xs-12 col-sm-8">
                    <button type="submit" class="btn btn-success btn-embossed  ">{:__('确定')}</button>
                    <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                </div>
            </div>
        </form>
        {/if}



        <script>
            function pp(){
                window.print();
            }

            // const printHtml = document.querySelector('.pri').innerHTML; // 需要打印的内容
            // window.document.body.innerHTML = printHtml;
            // window.print();
            // window.location.reload(); // 打印完成后重新加载页面
        </script>

        <a href="javascript:pp()" rel="external nofollow" class="btn btn-sm btn-success" target="_self">打印</a>



    </div>
</div>

